const request = require("/util/request")

// 查询订单列表
export function page(data) {
    return request({
        url: 'api/order/app/page',
        method: 'POST',
        data: data
    })
}
// 订单下单
export function save(data) {
    return request({
        url: 'api/order/app/save-order',
        method: 'POST',
        data: data
    })
}
// 查询订单详情
export function detail(id) {
    return request({
        url: `api/order/app/${id}/order-info`,
        method: 'GET',
    })
}
// 取消订单
export function canOrder(id,data) {
    return request({
        url: `api/order/app/${id}/cancel-order`,
        method: 'POST',
        methodType:'application',
        data:data
    })
}
export function requestCanOrder(id,data) {
    return request({
        url: `api/order/app/${id}/request-cancel-order`,
        method: 'POST',
        methodType:'application',
        data:data
    })
}
// 申请取消
export function reqCanOrder(id,data) {
    return request({
        url: `api/order/app/${id}/cancel-order`,
        method: 'POST',
        methodType:'application',
        data:data
    })
}
// 撤销=申请取消
export function repeal(id) {
    return request({
        url: `api/order/app/${id}/request-cancel-order/repeal`,
        method: 'POST',
        methodType:'application',
    })
}

// 支付订单
export function alipay(oid,id) {
    return request({
        url: `api/order/app/${oid}/pay-order/${id}/record`,
        method: 'POST',
        methodType:'application'
    })
}
// 提前还款
export function alipayRecords(data) {
  return request({
      url: `api/order/app/pay-orders/records`,
      method: 'POST',
      data: data,
      methodType:'application'
  })
}
// 提前买断
export function buyout(id) {
  return request({
      url: `api/order/app/${id}/buyout`,
      method: 'POST',
      methodType:'application'
  })
}
// 预授权
export function freeze(id) {
    return request({
        url: `api/order/app/${id}/freeze`,
        method: 'POST',
        methodType:'application'
    })
}
// 查看物流
export function getOne(id,data) {
    return request({
        url: `api/pd/getOne`,
        method: 'GET',
        data:data,
        methodType:'application'
    })
}
// 确认收货
export function receiving(id) {
    return request({
        url: `api/order/app/${id}/receiving`,
        method: 'GET',
        
    })
}
// 归还物品
export function giveBack(data) {
    return request({
        url: `api/order/app/giveBack`,
        method: 'post',
        data:data
    })
}

// 近期待还
export function monthList(data) {
  return request({
      url: `api/product/app/orderRecord/list`,
      method: 'get',
      data: data
  })
}